
package flc.ast.adapter;

import android.graphics.Color;
import android.widget.SeekBar;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.FileUtils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyZipBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class ZipAdapter extends StkProviderMultiAdapter<MyZipBean> {

    public ZipAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(80));
        addItemProvider(new ZipProvider());
    }

    private class ZipProvider extends BaseItemProvider<MyZipBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_zip;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyZipBean bean) {
            baseViewHolder.setText(R.id.tvZipItemName, bean.getName());
            baseViewHolder.setText(R.id.tvZipItemSize, bean.getSize());
            baseViewHolder.setText(R.id.tvZipItemNum, bean.getProgress() + "");
            if (bean.getProgress() == 100) {
                baseViewHolder.setText(R.id.tvZipItemNum, getContext().getString(R.string.zip_comp));
                baseViewHolder.setTextColor(R.id.tvZipItemNum, Color.parseColor("#FFFFFF"));
            }
        }
    }
}
